package com.cskaoyan.bean.wx_goods;

import com.cskaoyan.bean.PageDataVo;
import com.cskaoyan.bean.wx_home.WxGoods;
import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.util.List;

/**
 * @description:
 * @author: enhui
 **/
@Data
public class WxGoodsListPageVO<T> {
    private Integer total;
    private Integer pages;
    private Integer limit;
    private Integer page;
    private List<T> list;
    List<Category> filterCategoryList;

    public static <T> WxGoodsListPageVO ok(List<T> list, List<Category> filterCategoryList) {
        PageInfo<T> pageInfo = new PageInfo<>(list);
        WxGoodsListPageVO<T> WxGoodsListPageVO = new WxGoodsListPageVO<>();
        WxGoodsListPageVO.setPage(pageInfo.getPageNum());
        WxGoodsListPageVO.setLimit(pageInfo.getPageSize());
        WxGoodsListPageVO.setPages(pageInfo.getPages());
        WxGoodsListPageVO.setTotal((int) pageInfo.getTotal());
        WxGoodsListPageVO.setList(list);
        WxGoodsListPageVO.setFilterCategoryList(filterCategoryList);
        return WxGoodsListPageVO;
    }
}
